import axios from './settings'
import QS from 'qs'; // 引入qs模块，用来序列化post类型的数据

//登录接口
export function adminLogin(ruleForm) {
    return axios({
        url: '/api/adminLogin.php',
        method: 'get',
        params: ruleForm
    })
}

//添加新会员接口
export function addMember(userInfo) {
    return axios({
        url: '/api/addMember.php',
        method: 'post',
        data: QS.stringify(userInfo),
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
        }
    })
}

//查询所有的会员信息
export function getAllMember() {
    return axios({
        url: '/api/getAllMember.php',
        method: 'get',
    })
}

//删除会员信息
export function delMember(Id) {
    return axios({
        url: '/api/delMember.php',
        method: 'get',
        params: { Id }
    })
}

//更新会员信息
export function updateMember(userInfo) {
    return axios({
        url: '/api/updateMember.php',
        method: 'post',
        data: QS.stringify(userInfo),
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
        }
    })
}
//查询符合条件的会员信息 
export function selectMember(selectMsg) {
    return axios({
        url: '/api/selectMember.php',
        method: 'get',
        params: selectMsg

    })
}

